package edu.cuit.zhuyimeng.gateway.config;

import edu.cuit.zhuyimeng.gateway.network.SyncBlockingLoadBalancerClient;
import lombok.RequiredArgsConstructor;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.cloud.loadbalancer.support.LoadBalancerClientFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@RequiredArgsConstructor
public class LoadBalancerClientConfig {

    private final LoadBalancerClientFactory loadBalancerClientFactory;

    @Bean
    public LoadBalancerClient blockingLoadBalancerClient() {
        return new SyncBlockingLoadBalancerClient(loadBalancerClientFactory);
    }

}
